import { store } from '@/store'
import { defineStore } from 'pinia'
import { getAccessToken, removeToken } from '@/utils/auth'
import { CACHE_KEY, useCache, deleteUserCache } from '@/hooks/web/useCache'
import { getInfo, loginOut } from '@/api/login'
import { object } from 'vue-types'

const { wsCache } = useCache()

interface UserVO {
  id: number
  avatar: string
  nickname: string
  deptId: number
}

interface UserInfoVO {
  // USER 缓存
  permissions: string[]
  roles: string[]
  isSetUser: boolean
  user: UserVO
}

export const useUserStore = defineStore('admin-user', {
  state: (): UserInfoVO => ({
    permissions: [],
    roles: [],
    isSetUser: false,
    user: {
      id: 0,
      avatar: '',
      nickname: '',
      deptId: 0
    }
  }),
  getters: {
    getPermissions(): string[] {
      return this.permissions
    },
    getRoles(): string[] {
      return this.roles
    },
    getIsSetUser(): boolean {
      return this.isSetUser
    },
    getUser(): UserVO {
      return this.user
    }
  },
  actions: {
    async setUserInfoAction() {
      if (!getAccessToken()) {
        this.resetState()
        return null
      }

     
      let userInfo = wsCache.get(CACHE_KEY.USER)
      
      const hii= wsCache.get(CACHE_KEY.LOGINUSER);
    //   const hii=uid;
    //     try {
    //          hii= JSON.parse(uid) ;
    //     } catch (error) {
    //          hii= uid ;
    //     }
      if(hii){ 
        
        console.log(hii,">>>>hii>>>>>///")
        if(hii.loginUserId&&hii.isShopStatus==1){ //店铺审核通过
            userInfo = {
                "user":hii,
                "roles": [
                    "shangjiaok"
                ],
                "permissions": [
                    "",
                    "promotion:seckill-activity:update",
                    "trade:delivery:express:update",
                    "system:menu:query",
                    "promotion:diy-page:create",
                    "pay:refund:delete",
                    "system:user:query",
                    "promotion:combination-activity:query",
                    "promotion:diy-template:update",
                    "pay:channel:update",
                    "system:user:export",
                    "statistics:product:query",
                    "pay:merchant:delete",
                    "trade:config:query",
                    "statistics:trade:export",
                    "promotion:article:delete",
                    "promotion:seckill-config:update",
                    "pay:wallet-recharge-package:query",
                    "product:brand:query",
                    "system:role:delete",
                    "statistics:trade:query",
                    "system:menu:create",
                    "trade:delivery:pick-up-store:delete",
                    "system:dict:query",
                    "promotion:banner:delete",
                    "promotion:coupon-template:delete",
                    "trade:order:update",
                    "system:dict:update",
                    "pay:app:query",
                    "trade:after-sale:refund",
                    "promotion:coupon:query",
                    "trade:brokerage-user:update-bind-user",
                    "product:spu:delete",
                    "pay:order:delete",
                    "trade:delivery:pick-up-store:query",
                    "product:property:delete",
                    "trade:config:save",
                    "product:browse-history:query",
                    "promotion:diy-page:query",
                    "product:brand:delete",
                    "promotion:bargain-activity:delete",
                    "trade:delivery:express-template:update",
                    "product:spu:create",
                    "promotion:reward-activity:update",
                    "trade:brokerage-withdraw:query",
                    "promotion:article-category:create",
                    "trade:after-sale:query",
                    "trade:delivery:express:export",
                    "promotion:bargain-activity:query",
                    "trade:brokerage-user:clear-bind-user",
                    "pay:merchant:export",
                    "promotion:discount-activity:create",
                    "trade:brokerage-user:order-query",
                    "promotion:diy-template:query",
                    "product:category:query",
                    "promotion:combination-activity:update",
                    "pay:order:query",
                    "system:menu:update",
                    "trade:delivery:pick-up-store:export",
                    "trade:brokerage-withdraw:audit",
                    "system:role:update",
                    "trade:brokerage-user:update-brokerage-enable",
                    "pay:channel:query",
                    "product:category:update",
                    "promotion:discount-activity:close",
                    "system:user:create",
                    "product:property:update",
                    "system:role:export",
                    "pay:order:export",
                    "pay:merchant:query",
                    "trade:delivery:pick-up-store:update",
                    "product:brand:create",
                    "system:permission:assign-user-role",
                    "pay:order:update",
                    "product:spu:query",
                    "promotion:coupon:send",
                    "promotion:bargain-activity:update",
                    "product:comment:create",
                    "statistics:member:query",
                    "pay:refund:create",
                    "pay:app:delete",
                    "promotion:banner:create",
                    "promotion:combination-activity:close",
                    "product:property:query",
                    "trade:delivery:express-template:export",
                    "promotion:seckill-activity:delete",
                    "trade:delivery:express:delete",
                    "trade:order:query",
                    "statistics:product:export",
                    "pay:wallet:query",
                    "trade:brokerage-user:query",
                    "pay:refund:update",
                    "system:permission:assign-role-menu",
                    "trade:delivery:express-template:create",
                    "promotion:reward-activity:query",
                    "trade:delivery:express:query",
                    "trade:order:pick-up",
                    "promotion:article:update",
                    "promotion:seckill-config:delete",
                    "pay:channel:parsing",
                    "promotion:diy-template:delete",
                    "promotion:banner:query",
                    "promotion:discount-activity:delete",
                    "promotion:coupon-template:create",
                    "pay:channel:delete",
                    "promotion:combination-record:query",
                    "pay:merchant:update",
                    "product:comment:update",
                    "promotion:diy-template:use",
                    "trade:brokerage-user:user-query",
                    "pay:wallet-recharge-package:create",
                    "promotion:bargain-help:query",
                    "promotion:diy-page:delete",
                    "system:dict:create",
                    "promotion:bargain-record:query",
                    "pay:refund:query",
                    "pay:notify:query",
                    "promotion:article-category:query",
                    "promotion:coupon-template:query",
                    "product:category:create",
                    "promotion:article:query",
                    "pay:wallet-recharge-package:update",
                    "trade:after-sale:agree",
                    "pay:app:update",
                    "promotion:reward-activity:create",
                    "promotion:reward-activity:close",
                    "system:user:update-password",
                    "promotion:seckill-activity:query",
                    "trade:after-sale:disagree",
                    "system:dict:export",
                    "promotion:article-category:update",
                    "promotion:combination-activity:create",
                    "promotion:bargain-activity:close",
                    "promotion:seckill-config:create",
                    "product:comment:query",
                    "system:user:delete",
                    "pay:merchant:create",
                    "system:user:import",
                    "pay:app:create",
                    "promotion:article:create",
                    "system:user:update",
                    "product:spu:export",
                    "promotion:seckill-activity:create",
                    "system:menu:delete",
                    "trade:delivery:express:create",
                    "promotion:coupon:delete",
                    "trade:delivery:pick-up-store:create",
                    "product:category:delete",
                    "promotion:seckill-activity:close",
                    "promotion:reward-activity:delete",
                    "trade:after-sale:receive",
                    "system:permission:assign-role-data-scope",
                    "promotion:diy-page:update",
                    "pay:order:create",
                    "promotion:diy-template:create",
                    "promotion:banner:update",
                    "system:user:list",
                    "product:property:create",
                    "promotion:coupon-template:update",
                    "promotion:article-category:delete",
                    "promotion:seckill-config:query",
                    "promotion:discount-activity:update",
                    "pay:channel:create",
                    "promotion:combination-activity:delete",
                    "promotion:bargain-activity:create",
                    "product:spu:update",
                    "trade:delivery:express-template:query",
                    "pay:wallet-recharge-package:delete",
                    "product:favorite:query",
                    "system:role:create",
                    "system:dict:delete",
                    "product:brand:update",
                    "system:role:query",
                    "pay:refund:export",
                    "trade:delivery:express-template:delete",
                    "trade:brokerage-record:query",
                    "promotion:discount-activity:query"
                ],
                "menus": [
                    {
                        "id": 1,
                        "parentId": 0,
                        "name": "系统管理",
                        "path": "/system",
                        "component": null,
                        "componentName": null,
                        "icon": "ep:tools",
                        "visible": true,
                        "keepAlive": true,
                        "alwaysShow": true,
                        "children": [
                            {
                                "id": 100,
                                "parentId": 1,
                                "name": "用户管理",
                                "path": "user",
                                "component": "system/user/index",
                                "componentName": "SystemUser",
                                "icon": "ep:avatar",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                              "id": 100,
                              "parentId": 1,
                              "name": "商家管理",
                              "path": "users",
                              "component": "system/user/index?go=1",
                              "componentName": "SystemUsers",
                              "icon": "ep:avatar",
                              "visible": true,
                              "keepAlive": true,
                              "alwaysShow": true,
                              "children": null
                          }
      
                        ]
                    },
                    {
                        "id": 1117,
                        "parentId": 0,
                        "name": "支付管理",
                        "path": "/pay",
                        "component": null,
                        "componentName": null,
                        "icon": "ep:money",
                        "visible": true,
                        "keepAlive": true,
                        "alwaysShow": true,
                        "children": [
                            {
                                "id": 1126,
                                "parentId": 1117,
                                "name": "应用信息",
                                "path": "app",
                                "component": "pay/app/index",
                                "componentName": "PayApp",
                                "icon": "fa:apple",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                                "id": 1173,
                                "parentId": 1117,
                                "name": "支付订单",
                                "path": "order",
                                "component": "pay/order/index",
                                "componentName": "PayOrder",
                                "icon": "fa:cc-paypal",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                                "id": 1161,
                                "parentId": 1117,
                                "name": "退款订单",
                                "path": "refund",
                                "component": "pay/refund/index",
                                "componentName": "PayRefund",
                                "icon": "fa:registered",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                                "id": 2559,
                                "parentId": 1117,
                                "name": "转账订单",
                                "path": "transfer",
                                "component": "pay/transfer/index",
                                "componentName": "PayTransfer",
                                "icon": "ep:credit-card",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                                "id": 2551,
                                "parentId": 1117,
                                "name": "钱包管理",
                                "path": "wallet",
                                "component": "",
                                "componentName": "",
                                "icon": "ep:wallet",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": [
                                    {
                                        "id": 2557,
                                        "parentId": 2551,
                                        "name": "钱包余额",
                                        "path": "wallet-balance",
                                        "component": "pay/wallet/balance/index",
                                        "componentName": "WalletBalance",
                                        "icon": "fa:leaf",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2552,
                                        "parentId": 2551,
                                        "name": "充值套餐",
                                        "path": "wallet-recharge-package",
                                        "component": "pay/wallet/rechargePackage/index",
                                        "componentName": "WalletRechargePackage",
                                        "icon": "fa:leaf",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    }
                                ]
                            },
                            
                        ]
                    },
                    {
                        "id": 2362,
                        "parentId": 0,
                        "name": "商城系统",
                        "path": "/mall",
                        "component": "",
                        "componentName": "",
                        "icon": "ep:shop",
                        "visible": true,
                        "keepAlive": true,
                        "alwaysShow": true,
                        "children": [
                            {
                                "id": 2388,
                                "parentId": 2362,
                                "name": "商城首页",
                                "path": "home",
                                "component": "mall/home/index",
                                "componentName": "MallHome",
                                "icon": "ep:home-filled",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": null
                            },
                            {
                                "id": 2000,
                                "parentId": 2362,
                                "name": "商品中心",
                                "path": "product",
                                "component": null,
                                "componentName": null,
                                "icon": "fa:product-hunt",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": [
                                    {
                                        "id": 2014,
                                        "parentId": 2000,
                                        "name": "商品列表",
                                        "path": "spu",
                                        "component": "mall/product/spu/index",
                                        "componentName": "ProductSpu",
                                        "icon": "ep:apple",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2002,
                                        "parentId": 2000,
                                        "name": "商品分类",
                                        "path": "category",
                                        "component": "mall/product/category/index",
                                        "componentName": "ProductCategory",
                                        "icon": "ep:cellphone",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2008,
                                        "parentId": 2000,
                                        "name": "商品品牌",
                                        "path": "brand",
                                        "component": "mall/product/brand/index",
                                        "componentName": "ProductBrand",
                                        "icon": "ep:chicken",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2019,
                                        "parentId": 2000,
                                        "name": "商品属性",
                                        "path": "property",
                                        "component": "mall/product/property/index",
                                        "componentName": "ProductProperty",
                                        "icon": "ep:cold-drink",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2336,
                                        "parentId": 2000,
                                        "name": "商品评论",
                                        "path": "comment",
                                        "component": "mall/product/comment/index",
                                        "componentName": "ProductComment",
                                        "icon": "ep:comment",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    }
                                ]
                            },
                            {
                                "id": 2072,
                                "parentId": 2362,
                                "name": "订单中心",
                                "path": "trade",
                                "component": null,
                                "componentName": null,
                                "icon": "ep:eleme",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": [
                                    {
                                        "id": 2342,
                                        "parentId": 2072,
                                        "name": "交易配置",
                                        "path": "config",
                                        "component": "mall/trade/config/index",
                                        "componentName": "TradeConfig",
                                        "icon": "ep:setting",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2076,
                                        "parentId": 2072,
                                        "name": "订单列表",
                                        "path": "order",
                                        "component": "mall/trade/order/index",
                                        "componentName": "TradeOrder",
                                        "icon": "ep:list",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2073,
                                        "parentId": 2072,
                                        "name": "售后退款",
                                        "path": "after-sale",
                                        "component": "mall/trade/afterSale/index",
                                        "componentName": "TradeAfterSale",
                                        "icon": "ep:refrigerator",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2164,
                                        "parentId": 2072,
                                        "name": "配送管理",
                                        "path": "delivery",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "ep:shopping-cart",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2165,
                                                "parentId": 2164,
                                                "name": "快递发货",
                                                "path": "express",
                                                "component": "",
                                                "componentName": "",
                                                "icon": "ep:bicycle",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": [
                                                    {
                                                        "id": 2167,
                                                        "parentId": 2165,
                                                        "name": "快递公司",
                                                        "path": "express",
                                                        "component": "mall/trade/delivery/express/index",
                                                        "componentName": "Express",
                                                        "icon": "ep:compass",
                                                        "visible": true,
                                                        "keepAlive": true,
                                                        "alwaysShow": true,
                                                        "children": null
                                                    },
                                                    {
                                                        "id": 2173,
                                                        "parentId": 2165,
                                                        "name": "运费模版",
                                                        "path": "express-template",
                                                        "component": "mall/trade/delivery/expressTemplate/index",
                                                        "componentName": "ExpressTemplate",
                                                        "icon": "ep:coordinate",
                                                        "visible": true,
                                                        "keepAlive": true,
                                                        "alwaysShow": true,
                                                        "children": null
                                                    }
                                                ]
                                            },
                                            // {
                                            //     "id": 2166,
                                            //     "parentId": 2164,
                                            //     "name": "门店自提",
                                            //     "path": "pick-up-store",
                                            //     "component": "",
                                            //     "componentName": "",
                                            //     "icon": "ep:add-location",
                                            //     "visible": true,
                                            //     "keepAlive": true,
                                            //     "alwaysShow": true,
                                            //     "children": [
                                            //         {
                                            //             "id": 2179,
                                            //             "parentId": 2166,
                                            //             "name": "门店管理",
                                            //             "path": "pick-up-store",
                                            //             "component": "mall/trade/delivery/pickUpStore/index",
                                            //             "componentName": "PickUpStore",
                                            //             "icon": "ep:basketball",
                                            //             "visible": true,
                                            //             "keepAlive": true,
                                            //             "alwaysShow": true,
                                            //             "children": null
                                            //         },
                                            //         {
                                            //             "id": 2389,
                                            //             "parentId": 2166,
                                            //             "name": "核销订单",
                                            //             "path": "pick-up-order",
                                            //             "component": "mall/trade/delivery/pickUpOrder/index",
                                            //             "componentName": "PickUpOrder",
                                            //             "icon": "ep:list",
                                            //             "visible": true,
                                            //             "keepAlive": true,
                                            //             "alwaysShow": true,
                                            //             "children": null
                                            //         }
                                            //     ]
                                            // }
                                        ]
                                    },
                                    {
                                        "id": 2345,
                                        "parentId": 2072,
                                        "name": "分销管理",
                                        "path": "brokerage",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "fa-solid:project-diagram",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2346,
                                                "parentId": 2345,
                                                "name": "分销用户",
                                                "path": "brokerage-user",
                                                "component": "mall/trade/brokerage/user/index",
                                                "componentName": "TradeBrokerageUser",
                                                "icon": "fa-solid:user-tie",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2353,
                                                "parentId": 2345,
                                                "name": "佣金记录",
                                                "path": "brokerage-record",
                                                "component": "mall/trade/brokerage/record/index",
                                                "componentName": "TradeBrokerageRecord",
                                                "icon": "fa:money",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2355,
                                                "parentId": 2345,
                                                "name": "佣金提现",
                                                "path": "brokerage-withdraw",
                                                "component": "mall/trade/brokerage/withdraw/index",
                                                "componentName": "TradeBrokerageWithdraw",
                                                "icon": "fa:credit-card",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "id": 2030,
                                "parentId": 2362,
                                "name": "营销中心",
                                "path": "promotion",
                                "component": null,
                                "componentName": null,
                                "icon": "ep:present",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": [
                                    // {
                                    //     "id": 2387,
                                    //     "parentId": 2030,
                                    //     "name": "内容管理",
                                    //     "path": "content",
                                    //     "component": "",
                                    //     "componentName": "",
                                    //     "icon": "ep:collection",
                                    //     "visible": true,
                                    //     "keepAlive": true,
                                    //     "alwaysShow": true,
                                    //     "children": [
                                    //         {
                                    //             "id": 2377,
                                    //             "parentId": 2387,
                                    //             "name": "文章分类",
                                    //             "path": "article/category",
                                    //             "component": "mall/promotion/article/category/index",
                                    //             "componentName": "ArticleCategory",
                                    //             "icon": "fa:certificate",
                                    //             "visible": true,
                                    //             "keepAlive": true,
                                    //             "alwaysShow": true,
                                    //             "children": null
                                    //         },
                                    //         {
                                    //             "id": 2382,
                                    //             "parentId": 2387,
                                    //             "name": "文章列表",
                                    //             "path": "article",
                                    //             "component": "mall/promotion/article/index",
                                    //             "componentName": "Article",
                                    //             "icon": "ep:connection",
                                    //             "visible": true,
                                    //             "keepAlive": true,
                                    //             "alwaysShow": true,
                                    //             "children": null
                                    //         },
                                    //         {
                                    //             "id": 2025,
                                    //             "parentId": 2387,
                                    //             "name": "Banner",
                                    //             "path": "banner",
                                    //             "component": "mall/promotion/banner/index",
                                    //             "componentName": null,
                                    //             "icon": "fa:bandcamp",
                                    //             "visible": true,
                                    //             "keepAlive": true,
                                    //             "alwaysShow": true,
                                    //             "children": null
                                    //         }
                                    //     ]
                                    // },
                                    {
                                        "id": 2365,
                                        "parentId": 2030,
                                        "name": "优惠劵",
                                        "path": "coupon",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "fa-solid:disease",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2032,
                                                "parentId": 2365,
                                                "name": "优惠劵列表",
                                                "path": "template",
                                                "component": "mall/promotion/coupon/template/index",
                                                "componentName": "PromotionCouponTemplate",
                                                "icon": "ep:discount",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2038,
                                                "parentId": 2365,
                                                "name": "领取记录",
                                                "path": "list",
                                                "component": "mall/promotion/coupon/index",
                                                "componentName": "PromotionCoupon",
                                                "icon": "ep:collection-tag",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    },
                                    {
                                        "id": 2209,
                                        "parentId": 2030,
                                        "name": "秒杀活动",
                                        "path": "seckill",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "ep:place",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2066,
                                                "parentId": 2209,
                                                "name": "秒杀时段",
                                                "path": "config",
                                                "component": "mall/promotion/seckill/config/index",
                                                "componentName": "PromotionSeckillConfig",
                                                "icon": "ep:baseball",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2059,
                                                "parentId": 2209,
                                                "name": "秒杀商品",
                                                "path": "activity",
                                                "component": "mall/promotion/seckill/activity/index",
                                                "componentName": "PromotionSeckillActivity",
                                                "icon": "ep:basketball",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    },
                                    {
                                        "id": 2303,
                                        "parentId": 2030,
                                        "name": "拼团活动",
                                        "path": "combination",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "fa:group",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2304,
                                                "parentId": 2303,
                                                "name": "拼团商品",
                                                "path": "acitivity",
                                                "component": "mall/promotion/combination/activity/index",
                                                "componentName": "PromotionCombinationActivity",
                                                "icon": "ep:apple",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2369,
                                                "parentId": 2303,
                                                "name": "拼团记录",
                                                "path": "record",
                                                "component": "mall/promotion/combination/record/index.vue",
                                                "componentName": "PromotionCombinationRecord",
                                                "icon": "ep:avatar",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    },
                                    {
                                        "id": 2310,
                                        "parentId": 2030,
                                        "name": "砍价活动",
                                        "path": "bargain",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "ep:box",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2311,
                                                "parentId": 2310,
                                                "name": "砍价商品",
                                                "path": "activity",
                                                "component": "mall/promotion/bargain/activity/index",
                                                "componentName": "PromotionBargainActivity",
                                                "icon": "ep:burger",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2366,
                                                "parentId": 2310,
                                                "name": "砍价记录",
                                                "path": "record",
                                                "component": "mall/promotion/bargain/record/index",
                                                "componentName": "PromotionBargainRecord",
                                                "icon": "ep:list",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    },
                                    {
                                        "id": 2435,
                                        "parentId": 2030,
                                        "name": "商城装修",
                                        "path": "diy-template",
                                        "component": "mall/promotion/diy/template/index",
                                        "componentName": "DiyTemplate",
                                        "icon": "fa6-solid:brush",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2436,
                                                "parentId": 2435,
                                                "name": "装修模板",
                                                "path": "diy-template",
                                                "component": "mall/promotion/diy/template/index",
                                                "componentName": "DiyTemplate",
                                                "icon": "fa6-solid:brush",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2442,
                                                "parentId": 2435,
                                                "name": "装修页面",
                                                "path": "diy-page",
                                                "component": "mall/promotion/diy/page/index",
                                                "componentName": "DiyPage",
                                                "icon": "foundation:page-edit",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    },
                                    {
                                        "id": 2390,
                                        "parentId": 2030,
                                        "name": "优惠活动",
                                        "path": "youhui",
                                        "component": "",
                                        "componentName": "",
                                        "icon": "ep:aim",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": [
                                            {
                                                "id": 2047,
                                                "parentId": 2390,
                                                "name": "限时折扣",
                                                "path": "discount-activity",
                                                "component": "mall/promotion/discountActivity/index",
                                                "componentName": "PromotionDiscountActivity",
                                                "icon": "ep:timer",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            },
                                            {
                                                "id": 2041,
                                                "parentId": 2390,
                                                "name": "满减送",
                                                "path": "reward-activity",
                                                "component": "mall/promotion/rewardActivity/index",
                                                "componentName": "PromotionRewardActivity",
                                                "icon": "ep:goblet-square-full",
                                                "visible": true,
                                                "keepAlive": true,
                                                "alwaysShow": true,
                                                "children": null
                                            }
                                        ]
                                    }
                                ]
                            },
                            {
                                "id": 2358,
                                "parentId": 2362,
                                "name": "统计中心",
                                "path": "statistics",
                                "component": "",
                                "componentName": "",
                                "icon": "ep:data-line",
                                "visible": true,
                                "keepAlive": true,
                                "alwaysShow": true,
                                "children": [
                                    {
                                        "id": 2374,
                                        "parentId": 2358,
                                        "name": "会员统计",
                                        "path": "member",
                                        "component": "mall/statistics/member/index",
                                        "componentName": "MemberStatistics",
                                        "icon": "ep:avatar",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2545,
                                        "parentId": 2358,
                                        "name": "商品统计",
                                        "path": "product",
                                        "component": "mall/statistics/product/index",
                                        "componentName": "ProductStatistics",
                                        "icon": "fa:product-hunt",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    },
                                    {
                                        "id": 2359,
                                        "parentId": 2358,
                                        "name": "交易统计",
                                        "path": "trade",
                                        "component": "mall/statistics/trade/index",
                                        "componentName": "TradeStatistics",
                                        "icon": "fa-solid:credit-card",
                                        "visible": true,
                                        "keepAlive": true,
                                        "alwaysShow": true,
                                        "children": null
                                    }
                                ]
                            }
                        ]
                    }
                ]
        }
        
      }else    if(hii.loginUserId&&hii.isShopStatus!=1){ //店铺审核通过
        userInfo = {
            "user":hii,
            "roles": [
                "shangjiaNo"
            ],
            "permissions": [
                "",
                "promotion:seckill-activity:update",
                "trade:delivery:express:update",
                "system:menu:query",
                "promotion:diy-page:create",
                "pay:refund:delete",
                "system:user:query",
                "promotion:combination-activity:query",
                "promotion:diy-template:update",
                "pay:channel:update",
                "system:user:export",
                "statistics:product:query",
                "pay:merchant:delete",
                "trade:config:query",
                "statistics:trade:export",
                "promotion:article:delete",
                "promotion:seckill-config:update",
                "pay:wallet-recharge-package:query",
                "product:brand:query",
                "system:role:delete",
                "statistics:trade:query",
                "system:menu:create",
                "trade:delivery:pick-up-store:delete",
                "system:dict:query",
                "promotion:banner:delete",
                "promotion:coupon-template:delete",
                "trade:order:update",
                "system:dict:update",
                "pay:app:query",
                "trade:after-sale:refund",
                "promotion:coupon:query",
                "trade:brokerage-user:update-bind-user",
                "product:spu:delete",
                "pay:order:delete",
                "trade:delivery:pick-up-store:query",
                "product:property:delete",
                "trade:config:save",
                "product:browse-history:query",
                "promotion:diy-page:query",
                "product:brand:delete",
                "promotion:bargain-activity:delete",
                "trade:delivery:express-template:update",
                "product:spu:create",
                "promotion:reward-activity:update",
                "trade:brokerage-withdraw:query",
                "promotion:article-category:create",
                "trade:after-sale:query",
                "trade:delivery:express:export",
                "promotion:bargain-activity:query",
                "trade:brokerage-user:clear-bind-user",
                "pay:merchant:export",
                "promotion:discount-activity:create",
                "trade:brokerage-user:order-query",
                "promotion:diy-template:query",
                "product:category:query",
                "promotion:combination-activity:update",
                "pay:order:query",
                "system:menu:update",
                "trade:delivery:pick-up-store:export",
                "trade:brokerage-withdraw:audit",
                "system:role:update",
                "trade:brokerage-user:update-brokerage-enable",
                "pay:channel:query",
                "product:category:update",
                "promotion:discount-activity:close",
                "system:user:create",
                "product:property:update",
                "system:role:export",
                "pay:order:export",
                "pay:merchant:query",
                "trade:delivery:pick-up-store:update",
                "product:brand:create",
                "system:permission:assign-user-role",
                "pay:order:update",
                "product:spu:query",
                "promotion:coupon:send",
                "promotion:bargain-activity:update",
                "product:comment:create",
                "statistics:member:query",
                "pay:refund:create",
                "pay:app:delete",
                "promotion:banner:create",
                "promotion:combination-activity:close",
                "product:property:query",
                "trade:delivery:express-template:export",
                "promotion:seckill-activity:delete",
                "trade:delivery:express:delete",
                "trade:order:query",
                "statistics:product:export",
                "pay:wallet:query",
                "trade:brokerage-user:query",
                "pay:refund:update",
                "system:permission:assign-role-menu",
                "trade:delivery:express-template:create",
                "promotion:reward-activity:query",
                "trade:delivery:express:query",
                "trade:order:pick-up",
                "promotion:article:update",
                "promotion:seckill-config:delete",
                "pay:channel:parsing",
                "promotion:diy-template:delete",
                "promotion:banner:query",
                "promotion:discount-activity:delete",
                "promotion:coupon-template:create",
                "pay:channel:delete",
                "promotion:combination-record:query",
                "pay:merchant:update",
                "product:comment:update",
                "promotion:diy-template:use",
                "trade:brokerage-user:user-query",
                "pay:wallet-recharge-package:create",
                "promotion:bargain-help:query",
                "promotion:diy-page:delete",
                "system:dict:create",
                "promotion:bargain-record:query",
                "pay:refund:query",
                "pay:notify:query",
                "promotion:article-category:query",
                "promotion:coupon-template:query",
                "product:category:create",
                "promotion:article:query",
                "pay:wallet-recharge-package:update",
                "trade:after-sale:agree",
                "pay:app:update",
                "promotion:reward-activity:create",
                "promotion:reward-activity:close",
                "system:user:update-password",
                "promotion:seckill-activity:query",
                "trade:after-sale:disagree",
                "system:dict:export",
                "promotion:article-category:update",
                "promotion:combination-activity:create",
                "promotion:bargain-activity:close",
                "promotion:seckill-config:create",
                "product:comment:query",
                "system:user:delete",
                "pay:merchant:create",
                "system:user:import",
                "pay:app:create",
                "promotion:article:create",
                "system:user:update",
                "product:spu:export",
                "promotion:seckill-activity:create",
                "system:menu:delete",
                "trade:delivery:express:create",
                "promotion:coupon:delete",
                "trade:delivery:pick-up-store:create",
                "product:category:delete",
                "promotion:seckill-activity:close",
                "promotion:reward-activity:delete",
                "trade:after-sale:receive",
                "system:permission:assign-role-data-scope",
                "promotion:diy-page:update",
                "pay:order:create",
                "promotion:diy-template:create",
                "promotion:banner:update",
                "system:user:list",
                "product:property:create",
                "promotion:coupon-template:update",
                "promotion:article-category:delete",
                "promotion:seckill-config:query",
                "promotion:discount-activity:update",
                "pay:channel:create",
                "promotion:combination-activity:delete",
                "promotion:bargain-activity:create",
                "product:spu:update",
                "trade:delivery:express-template:query",
                "pay:wallet-recharge-package:delete",
                "product:favorite:query",
                "system:role:create",
                "system:dict:delete",
                "product:brand:update",
                "system:role:query",
                "pay:refund:export",
                "trade:delivery:express-template:delete",
                "trade:brokerage-record:query",
                "promotion:discount-activity:query"
            ],
            "menus": [
                {
                    "id": 1,
                    "parentId": 0,
                    "name": "个人信息",
                    "path": "/system",
                    "component": null,
                    "componentName": null,
                    "icon": "ep:tools",
                    "visible": true,
                    "keepAlive": true,
                    "alwaysShow": true,
                    "children": [
                        
                        {
                          "id": 100,
                          "parentId": 1,
                          "name": "店铺管理",
                          "path": "users",
                          "component": "system/user/index?go=1",
                          "componentName": "SystemUsers",
                          "icon": "ep:avatar",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      }
  
                    ]
                },
                
            ]
         }
           
      } else
    
      if(!hii.loginUserId&&hii.isShopStatus!=1) {
        // userInfo = await getInfo()
        userInfo = {
          "user": hii,
          "roles": [
              "scgyl"
          ],
          "permissions": [
              "",
              "promotion:seckill-activity:update",
              "trade:delivery:express:update",
              "system:menu:query",
              "promotion:diy-page:create",
              "pay:refund:delete",
              "system:user:query",
              "promotion:combination-activity:query",
              "promotion:diy-template:update",
              "pay:channel:update",
              "system:user:export",
              "statistics:product:query",
              "pay:merchant:delete",
              "trade:config:query",
              "statistics:trade:export",
              "promotion:article:delete",
              "promotion:seckill-config:update",
              "pay:wallet-recharge-package:query",
              "product:brand:query",
              "system:role:delete",
              "statistics:trade:query",
              "system:menu:create",
              "trade:delivery:pick-up-store:delete",
              "system:dict:query",
              "promotion:banner:delete",
              "promotion:coupon-template:delete",
              "trade:order:update",
              "system:dict:update",
              "pay:app:query",
              "trade:after-sale:refund",
              "promotion:coupon:query",
              "trade:brokerage-user:update-bind-user",
              "product:spu:delete",
              "pay:order:delete",
              "trade:delivery:pick-up-store:query",
              "product:property:delete",
              "trade:config:save",
              "product:browse-history:query",
              "promotion:diy-page:query",
              "product:brand:delete",
              "promotion:bargain-activity:delete",
              "trade:delivery:express-template:update",
              "product:spu:create",
              "promotion:reward-activity:update",
              "trade:brokerage-withdraw:query",
              "promotion:article-category:create",
              "trade:after-sale:query",
              "trade:delivery:express:export",
              "promotion:bargain-activity:query",
              "trade:brokerage-user:clear-bind-user",
              "pay:merchant:export",
              "promotion:discount-activity:create",
              "trade:brokerage-user:order-query",
              "promotion:diy-template:query",
              "product:category:query",
              "promotion:combination-activity:update",
              "pay:order:query",
              "system:menu:update",
              "trade:delivery:pick-up-store:export",
              "trade:brokerage-withdraw:audit",
              "system:role:update",
              "trade:brokerage-user:update-brokerage-enable",
              "pay:channel:query",
              "product:category:update",
              "promotion:discount-activity:close",
              "system:user:create",
              "product:property:update",
              "system:role:export",
              "pay:order:export",
              "pay:merchant:query",
              "trade:delivery:pick-up-store:update",
              "product:brand:create",
              "system:permission:assign-user-role",
              "pay:order:update",
              "product:spu:query",
              "promotion:coupon:send",
              "promotion:bargain-activity:update",
              "product:comment:create",
              "statistics:member:query",
              "pay:refund:create",
              "pay:app:delete",
              "promotion:banner:create",
              "promotion:combination-activity:close",
              "product:property:query",
              "trade:delivery:express-template:export",
              "promotion:seckill-activity:delete",
              "trade:delivery:express:delete",
              "trade:order:query",
              "statistics:product:export",
              "pay:wallet:query",
              "trade:brokerage-user:query",
              "pay:refund:update",
              "system:permission:assign-role-menu",
              "trade:delivery:express-template:create",
              "promotion:reward-activity:query",
              "trade:delivery:express:query",
              "trade:order:pick-up",
              "promotion:article:update",
              "promotion:seckill-config:delete",
              "pay:channel:parsing",
              "promotion:diy-template:delete",
              "promotion:banner:query",
              "promotion:discount-activity:delete",
              "promotion:coupon-template:create",
              "pay:channel:delete",
              "promotion:combination-record:query",
              "pay:merchant:update",
              "product:comment:update",
              "promotion:diy-template:use",
              "trade:brokerage-user:user-query",
              "pay:wallet-recharge-package:create",
              "promotion:bargain-help:query",
              "promotion:diy-page:delete",
              "system:dict:create",
              "promotion:bargain-record:query",
              "pay:refund:query",
              "pay:notify:query",
              "promotion:article-category:query",
              "promotion:coupon-template:query",
              "product:category:create",
              "promotion:article:query",
              "pay:wallet-recharge-package:update",
              "trade:after-sale:agree",
              "pay:app:update",
              "promotion:reward-activity:create",
              "promotion:reward-activity:close",
              "system:user:update-password",
              "promotion:seckill-activity:query",
              "trade:after-sale:disagree",
              "system:dict:export",
              "promotion:article-category:update",
              "promotion:combination-activity:create",
              "promotion:bargain-activity:close",
              "promotion:seckill-config:create",
              "product:comment:query",
              "system:user:delete",
              "pay:merchant:create",
              "system:user:import",
              "pay:app:create",
              "promotion:article:create",
              "system:user:update",
              "product:spu:export",
              "promotion:seckill-activity:create",
              "system:menu:delete",
              "trade:delivery:express:create",
              "promotion:coupon:delete",
              "trade:delivery:pick-up-store:create",
              "product:category:delete",
              "promotion:seckill-activity:close",
              "promotion:reward-activity:delete",
              "trade:after-sale:receive",
              "system:permission:assign-role-data-scope",
              "promotion:diy-page:update",
              "pay:order:create",
              "promotion:diy-template:create",
              "promotion:banner:update",
              "system:user:list",
              "product:property:create",
              "promotion:coupon-template:update",
              "promotion:article-category:delete",
              "promotion:seckill-config:query",
              "promotion:discount-activity:update",
              "pay:channel:create",
              "promotion:combination-activity:delete",
              "promotion:bargain-activity:create",
              "product:spu:update",
              "trade:delivery:express-template:query",
              "pay:wallet-recharge-package:delete",
              "product:favorite:query",
              "system:role:create",
              "system:dict:delete",
              "product:brand:update",
              "system:role:query",
              "pay:refund:export",
              "trade:delivery:express-template:delete",
              "trade:brokerage-record:query",
              "promotion:discount-activity:query"
          ],
          "menus": [
              {
                  "id": 1,
                  "parentId": 0,
                  "name": "系统管理",
                  "path": "/system",
                  "component": null,
                  "componentName": null,
                  "icon": "ep:tools",
                  "visible": true,
                  "keepAlive": true,
                  "alwaysShow": true,
                  "children": [
                      {
                          "id": 100,
                          "parentId": 1,
                          "name": "用户管理",
                          "path": "user",
                          "component": "system/user/index",
                          "componentName": "SystemUser",
                          "icon": "ep:avatar",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                        "id": 100,
                        "parentId": 1,
                        "name": "商家管理",
                        "path": "users",
                        "component": "system/user/index?go=1",
                        "componentName": "SystemUsers",
                        "icon": "ep:avatar",
                        "visible": true,
                        "keepAlive": true,
                        "alwaysShow": true,
                        "children": null
                    },  

                      {
                          "id": 101,
                          "parentId": 1,
                          "name": "角色管理",
                          "path": "role",
                          "component": "system/role/index",
                          "componentName": "SystemRole",
                          "icon": "ep:user",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 102,
                          "parentId": 1,
                          "name": "菜单管理",
                          "path": "menu",
                          "component": "system/menu/index",
                          "componentName": "SystemMenu",
                          "icon": "ep:menu",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 105,
                          "parentId": 1,
                          "name": "字典管理",
                          "path": "dict",
                          "component": "system/dict/index",
                          "componentName": "SystemDictType",
                          "icon": "ep:collection",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      }
                  ]
              },
              {
                  "id": 1117,
                  "parentId": 0,
                  "name": "支付管理",
                  "path": "/pay",
                  "component": null,
                  "componentName": null,
                  "icon": "ep:money",
                  "visible": true,
                  "keepAlive": true,
                  "alwaysShow": true,
                  "children": [
                      {
                          "id": 1126,
                          "parentId": 1117,
                          "name": "应用信息",
                          "path": "app",
                          "component": "pay/app/index",
                          "componentName": "PayApp",
                          "icon": "fa:apple",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 1173,
                          "parentId": 1117,
                          "name": "支付订单",
                          "path": "order",
                          "component": "pay/order/index",
                          "componentName": "PayOrder",
                          "icon": "fa:cc-paypal",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 1161,
                          "parentId": 1117,
                          "name": "退款订单",
                          "path": "refund",
                          "component": "pay/refund/index",
                          "componentName": "PayRefund",
                          "icon": "fa:registered",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 2559,
                          "parentId": 1117,
                          "name": "转账订单",
                          "path": "transfer",
                          "component": "pay/transfer/index",
                          "componentName": "PayTransfer",
                          "icon": "ep:credit-card",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 2551,
                          "parentId": 1117,
                          "name": "钱包管理",
                          "path": "wallet",
                          "component": "",
                          "componentName": "",
                          "icon": "ep:wallet",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2557,
                                  "parentId": 2551,
                                  "name": "钱包余额",
                                  "path": "wallet-balance",
                                  "component": "pay/wallet/balance/index",
                                  "componentName": "WalletBalance",
                                  "icon": "fa:leaf",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2552,
                                  "parentId": 2551,
                                  "name": "充值套餐",
                                  "path": "wallet-recharge-package",
                                  "component": "pay/wallet/rechargePackage/index",
                                  "componentName": "WalletRechargePackage",
                                  "icon": "fa:leaf",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              }
                          ]
                      },
                      {
                          "id": 2301,
                          "parentId": 1117,
                          "name": "回调通知",
                          "path": "notify",
                          "component": "pay/notify/index",
                          "componentName": "PayNotify",
                          "icon": "ep:mute-notification",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 2161,
                          "parentId": 1117,
                          "name": "接入示例",
                          "path": "demo",
                          "component": "pay/demo/index",
                          "componentName": null,
                          "icon": "fa-solid:dragon",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2549,
                                  "parentId": 2161,
                                  "name": "支付&退款案例",
                                  "path": "order",
                                  "component": "pay/demo/order/index",
                                  "componentName": "",
                                  "icon": "fa:paypal",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2550,
                                  "parentId": 2161,
                                  "name": "转账案例",
                                  "path": "transfer",
                                  "component": "pay/demo/transfer/index",
                                  "componentName": "",
                                  "icon": "fa:transgender-alt",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              }
                          ]
                      }
                  ]
              },
              {
                  "id": 2362,
                  "parentId": 0,
                  "name": "商城系统",
                  "path": "/mall",
                  "component": "",
                  "componentName": "",
                  "icon": "ep:shop",
                  "visible": true,
                  "keepAlive": true,
                  "alwaysShow": true,
                  "children": [
                      {
                          "id": 2388,
                          "parentId": 2362,
                          "name": "商城首页",
                          "path": "home",
                          "component": "mall/home/index",
                          "componentName": "MallHome",
                          "icon": "ep:home-filled",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": null
                      },
                      {
                          "id": 2000,
                          "parentId": 2362,
                          "name": "商品中心",
                          "path": "product",
                          "component": null,
                          "componentName": null,
                          "icon": "fa:product-hunt",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2014,
                                  "parentId": 2000,
                                  "name": "商品列表",
                                  "path": "spu",
                                  "component": "mall/product/spu/index",
                                  "componentName": "ProductSpu",
                                  "icon": "ep:apple",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2002,
                                  "parentId": 2000,
                                  "name": "商品分类",
                                  "path": "category",
                                  "component": "mall/product/category/index",
                                  "componentName": "ProductCategory",
                                  "icon": "ep:cellphone",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2008,
                                  "parentId": 2000,
                                  "name": "商品品牌",
                                  "path": "brand",
                                  "component": "mall/product/brand/index",
                                  "componentName": "ProductBrand",
                                  "icon": "ep:chicken",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2019,
                                  "parentId": 2000,
                                  "name": "商品属性",
                                  "path": "property",
                                  "component": "mall/product/property/index",
                                  "componentName": "ProductProperty",
                                  "icon": "ep:cold-drink",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2336,
                                  "parentId": 2000,
                                  "name": "商品评论",
                                  "path": "comment",
                                  "component": "mall/product/comment/index",
                                  "componentName": "ProductComment",
                                  "icon": "ep:comment",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              }
                          ]
                      },
                      {
                          "id": 2072,
                          "parentId": 2362,
                          "name": "订单中心",
                          "path": "trade",
                          "component": null,
                          "componentName": null,
                          "icon": "ep:eleme",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2342,
                                  "parentId": 2072,
                                  "name": "交易配置",
                                  "path": "config",
                                  "component": "mall/trade/config/index",
                                  "componentName": "TradeConfig",
                                  "icon": "ep:setting",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2076,
                                  "parentId": 2072,
                                  "name": "订单列表",
                                  "path": "order",
                                  "component": "mall/trade/order/index",
                                  "componentName": "TradeOrder",
                                  "icon": "ep:list",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2073,
                                  "parentId": 2072,
                                  "name": "售后退款",
                                  "path": "after-sale",
                                  "component": "mall/trade/afterSale/index",
                                  "componentName": "TradeAfterSale",
                                  "icon": "ep:refrigerator",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2164,
                                  "parentId": 2072,
                                  "name": "配送管理",
                                  "path": "delivery",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "ep:shopping-cart",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2165,
                                          "parentId": 2164,
                                          "name": "快递发货",
                                          "path": "express",
                                          "component": "",
                                          "componentName": "",
                                          "icon": "ep:bicycle",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": [
                                              {
                                                  "id": 2167,
                                                  "parentId": 2165,
                                                  "name": "快递公司",
                                                  "path": "express",
                                                  "component": "mall/trade/delivery/express/index",
                                                  "componentName": "Express",
                                                  "icon": "ep:compass",
                                                  "visible": true,
                                                  "keepAlive": true,
                                                  "alwaysShow": true,
                                                  "children": null
                                              },
                                              {
                                                  "id": 2173,
                                                  "parentId": 2165,
                                                  "name": "运费模版",
                                                  "path": "express-template",
                                                  "component": "mall/trade/delivery/expressTemplate/index",
                                                  "componentName": "ExpressTemplate",
                                                  "icon": "ep:coordinate",
                                                  "visible": true,
                                                  "keepAlive": true,
                                                  "alwaysShow": true,
                                                  "children": null
                                              }
                                          ]
                                      },
                                    //   {
                                    //       "id": 2166,
                                    //       "parentId": 2164,
                                    //       "name": "门店自提",
                                    //       "path": "pick-up-store",
                                    //       "component": "",
                                    //       "componentName": "",
                                    //       "icon": "ep:add-location",
                                    //       "visible": true,
                                    //       "keepAlive": true,
                                    //       "alwaysShow": true,
                                    //       "children": [
                                    //           {
                                    //               "id": 2179,
                                    //               "parentId": 2166,
                                    //               "name": "门店管理",
                                    //               "path": "pick-up-store",
                                    //               "component": "mall/trade/delivery/pickUpStore/index",
                                    //               "componentName": "PickUpStore",
                                    //               "icon": "ep:basketball",
                                    //               "visible": true,
                                    //               "keepAlive": true,
                                    //               "alwaysShow": true,
                                    //               "children": null
                                    //           },
                                    //           {
                                    //               "id": 2389,
                                    //               "parentId": 2166,
                                    //               "name": "核销订单",
                                    //               "path": "pick-up-order",
                                    //               "component": "mall/trade/delivery/pickUpOrder/index",
                                    //               "componentName": "PickUpOrder",
                                    //               "icon": "ep:list",
                                    //               "visible": true,
                                    //               "keepAlive": true,
                                    //               "alwaysShow": true,
                                    //               "children": null
                                    //           }
                                    //       ]
                                    //   }
                                  ]
                              },
                              {
                                  "id": 2345,
                                  "parentId": 2072,
                                  "name": "分销管理",
                                  "path": "brokerage",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "fa-solid:project-diagram",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2346,
                                          "parentId": 2345,
                                          "name": "分销用户",
                                          "path": "brokerage-user",
                                          "component": "mall/trade/brokerage/user/index",
                                          "componentName": "TradeBrokerageUser",
                                          "icon": "fa-solid:user-tie",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2353,
                                          "parentId": 2345,
                                          "name": "佣金记录",
                                          "path": "brokerage-record",
                                          "component": "mall/trade/brokerage/record/index",
                                          "componentName": "TradeBrokerageRecord",
                                          "icon": "fa:money",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2355,
                                          "parentId": 2345,
                                          "name": "佣金提现",
                                          "path": "brokerage-withdraw",
                                          "component": "mall/trade/brokerage/withdraw/index",
                                          "componentName": "TradeBrokerageWithdraw",
                                          "icon": "fa:credit-card",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              }
                          ]
                      },
                      {
                          "id": 2030,
                          "parentId": 2362,
                          "name": "营销中心",
                          "path": "promotion",
                          "component": null,
                          "componentName": null,
                          "icon": "ep:present",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2387,
                                  "parentId": 2030,
                                  "name": "内容管理",
                                  "path": "content",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "ep:collection",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2377,
                                          "parentId": 2387,
                                          "name": "文章分类",
                                          "path": "article/category",
                                          "component": "mall/promotion/article/category/index",
                                          "componentName": "ArticleCategory",
                                          "icon": "fa:certificate",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2382,
                                          "parentId": 2387,
                                          "name": "文章列表",
                                          "path": "article",
                                          "component": "mall/promotion/article/index",
                                          "componentName": "Article",
                                          "icon": "ep:connection",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2025,
                                          "parentId": 2387,
                                          "name": "Banner",
                                          "path": "banner",
                                          "component": "mall/promotion/banner/index",
                                          "componentName": null,
                                          "icon": "fa:bandcamp",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2365,
                                  "parentId": 2030,
                                  "name": "优惠劵",
                                  "path": "coupon",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "fa-solid:disease",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2032,
                                          "parentId": 2365,
                                          "name": "优惠劵列表",
                                          "path": "template",
                                          "component": "mall/promotion/coupon/template/index",
                                          "componentName": "PromotionCouponTemplate",
                                          "icon": "ep:discount",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2038,
                                          "parentId": 2365,
                                          "name": "领取记录",
                                          "path": "list",
                                          "component": "mall/promotion/coupon/index",
                                          "componentName": "PromotionCoupon",
                                          "icon": "ep:collection-tag",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2209,
                                  "parentId": 2030,
                                  "name": "秒杀活动",
                                  "path": "seckill",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "ep:place",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2066,
                                          "parentId": 2209,
                                          "name": "秒杀时段",
                                          "path": "config",
                                          "component": "mall/promotion/seckill/config/index",
                                          "componentName": "PromotionSeckillConfig",
                                          "icon": "ep:baseball",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2059,
                                          "parentId": 2209,
                                          "name": "秒杀商品",
                                          "path": "activity",
                                          "component": "mall/promotion/seckill/activity/index",
                                          "componentName": "PromotionSeckillActivity",
                                          "icon": "ep:basketball",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2303,
                                  "parentId": 2030,
                                  "name": "拼团活动",
                                  "path": "combination",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "fa:group",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2304,
                                          "parentId": 2303,
                                          "name": "拼团商品",
                                          "path": "acitivity",
                                          "component": "mall/promotion/combination/activity/index",
                                          "componentName": "PromotionCombinationActivity",
                                          "icon": "ep:apple",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2369,
                                          "parentId": 2303,
                                          "name": "拼团记录",
                                          "path": "record",
                                          "component": "mall/promotion/combination/record/index.vue",
                                          "componentName": "PromotionCombinationRecord",
                                          "icon": "ep:avatar",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2310,
                                  "parentId": 2030,
                                  "name": "砍价活动",
                                  "path": "bargain",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "ep:box",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2311,
                                          "parentId": 2310,
                                          "name": "砍价商品",
                                          "path": "activity",
                                          "component": "mall/promotion/bargain/activity/index",
                                          "componentName": "PromotionBargainActivity",
                                          "icon": "ep:burger",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2366,
                                          "parentId": 2310,
                                          "name": "砍价记录",
                                          "path": "record",
                                          "component": "mall/promotion/bargain/record/index",
                                          "componentName": "PromotionBargainRecord",
                                          "icon": "ep:list",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2435,
                                  "parentId": 2030,
                                  "name": "商城装修",
                                  "path": "diy-template",
                                  "component": "mall/promotion/diy/template/index",
                                  "componentName": "DiyTemplate",
                                  "icon": "fa6-solid:brush",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2436,
                                          "parentId": 2435,
                                          "name": "装修模板",
                                          "path": "diy-template",
                                          "component": "mall/promotion/diy/template/index",
                                          "componentName": "DiyTemplate",
                                          "icon": "fa6-solid:brush",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2442,
                                          "parentId": 2435,
                                          "name": "装修页面",
                                          "path": "diy-page",
                                          "component": "mall/promotion/diy/page/index",
                                          "componentName": "DiyPage",
                                          "icon": "foundation:page-edit",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              },
                              {
                                  "id": 2390,
                                  "parentId": 2030,
                                  "name": "优惠活动",
                                  "path": "youhui",
                                  "component": "",
                                  "componentName": "",
                                  "icon": "ep:aim",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": [
                                      {
                                          "id": 2047,
                                          "parentId": 2390,
                                          "name": "限时折扣",
                                          "path": "discount-activity",
                                          "component": "mall/promotion/discountActivity/index",
                                          "componentName": "PromotionDiscountActivity",
                                          "icon": "ep:timer",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      },
                                      {
                                          "id": 2041,
                                          "parentId": 2390,
                                          "name": "满减送",
                                          "path": "reward-activity",
                                          "component": "mall/promotion/rewardActivity/index",
                                          "componentName": "PromotionRewardActivity",
                                          "icon": "ep:goblet-square-full",
                                          "visible": true,
                                          "keepAlive": true,
                                          "alwaysShow": true,
                                          "children": null
                                      }
                                  ]
                              }
                          ]
                      },
                      {
                          "id": 2358,
                          "parentId": 2362,
                          "name": "统计中心",
                          "path": "statistics",
                          "component": "",
                          "componentName": "",
                          "icon": "ep:data-line",
                          "visible": true,
                          "keepAlive": true,
                          "alwaysShow": true,
                          "children": [
                              {
                                  "id": 2374,
                                  "parentId": 2358,
                                  "name": "会员统计",
                                  "path": "member",
                                  "component": "mall/statistics/member/index",
                                  "componentName": "MemberStatistics",
                                  "icon": "ep:avatar",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2545,
                                  "parentId": 2358,
                                  "name": "商品统计",
                                  "path": "product",
                                  "component": "mall/statistics/product/index",
                                  "componentName": "ProductStatistics",
                                  "icon": "fa:product-hunt",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              },
                              {
                                  "id": 2359,
                                  "parentId": 2358,
                                  "name": "交易统计",
                                  "path": "trade",
                                  "component": "mall/statistics/trade/index",
                                  "componentName": "TradeStatistics",
                                  "icon": "fa-solid:credit-card",
                                  "visible": true,
                                  "keepAlive": true,
                                  "alwaysShow": true,
                                  "children": null
                              }
                          ]
                      }
                  ]
              }
          ]
        }
      }
    } else{
        userInfo = {
            "user":null,
            "roles": [
                "nobody"
            ],
            "permissions": [],
            "menus": []
        }
        localStorage.clear();
        location.href="/login"
        return;
    } 
      console.log("LLLLLLL",userInfo)
    //   this.permissions = userInfo.permissions
    //   this.roles = userInfo.roles
    //   this.user = userInfo.user
    //   this.isSetUser = true
        wsCache.set(CACHE_KEY.LOGINUSER, userInfo.user)
      wsCache.set(CACHE_KEY.USER, userInfo)
      wsCache.set(CACHE_KEY.ROLE_ROUTERS, userInfo.menus.user)
    },
    async setUserAvatarAction(avatar: string) {
      const userInfo = wsCache.get(CACHE_KEY.USER)
      // NOTE: 是否需要像`setUserInfoAction`一样判断`userInfo != null`
      this.user.avatar = avatar
      userInfo.user.avatar = avatar
      wsCache.set(CACHE_KEY.USER, userInfo)
    },
    async setUserNicknameAction(nickname: string) {
      const userInfo = wsCache.get(CACHE_KEY.USER)
      // NOTE: 是否需要像`setUserInfoAction`一样判断`userInfo != null`
      this.user.nickname = nickname
      userInfo.user.nickname = nickname
      wsCache.set(CACHE_KEY.USER, userInfo)
    },
    async loginOut() {
     
      setTimeout(() => {
        localStorage.clear()
        window.location.href = '/login'
      }, 2000);
      await loginOut()
      removeToken()
      deleteUserCache() // 删除用户缓存
      this.resetState();
    },
    resetState() {
      this.permissions = []
      this.roles = []
      this.isSetUser = false
      this.user = {
        id: 0,
        avatar: '',
        nickname: '',
        deptId: 0
      }
    }
  }
})

export const useUserStoreWithOut = () => {
  return useUserStore(store)
}
